<html>
<head><meta charset="utf-8"><title>Specialization · project-error-handling · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/index.html">project-error-handling</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Specialization.html">Specialization</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="218026087"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Specialization/near/218026087" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremiah Senkpiel <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Specialization.html#218026087">(Nov 26 2020 at 17:48)</a>:</h4>
<p>Btw, should this group be invested in moving specialization along at all?</p>
<p>I ask particularly because of the whole "&lt;anyhow&gt; can't implement StdError because it would conflict between <code>From&lt;StdError&gt;</code> and <code>From&lt;Self&gt;</code>"?</p>



<a name="218026136"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Specialization/near/218026136" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremiah Senkpiel <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Specialization.html#218026136">(Nov 26 2020 at 17:48)</a>:</h4>
<p>Unless that is somehow planned to be solved somehow else? (Although I can't imagine how...)</p>



<a name="218026443"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Specialization/near/218026443" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Specialization.html#218026443">(Nov 26 2020 at 17:52)</a>:</h4>
<p>as long as they are part of the same specialization family?</p>



<a name="218026654"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Specialization/near/218026654" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremiah Senkpiel <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Specialization.html#218026654">(Nov 26 2020 at 17:55)</a>:</h4>
<p>Not sure I follow - my understanding is that what would be desirable here would be <code>impl StdError for Self</code> and then i.e. <code>From&lt;T: StdError NOT Self&gt;</code>?</p>



<a name="218026711"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Specialization/near/218026711" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremiah Senkpiel <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Specialization.html#218026711">(Nov 26 2020 at 17:56)</a>:</h4>
<p>i.e. negative bounds, or a special self exclusion bound</p>



<a name="218027737"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Specialization/near/218027737" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Specialization.html#218027737">(Nov 26 2020 at 18:11)</a>:</h4>
<p>from what I recall there is resistance to having conditional negative impls</p>



<a name="218027806"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Specialization/near/218027806" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Specialization.html#218027806">(Nov 26 2020 at 18:12)</a>:</h4>
<p>though this might be added for Error return traces as a missing feature</p>



<a name="218027939"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Specialization/near/218027939" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Specialization.html#218027939">(Nov 26 2020 at 18:14)</a>:</h4>
<p>I think that negative impl is intended to be <code>impl !StdErr ..</code> rather than allowing for opt-in for various traits overlapping with conditional impls</p>



<a name="218028609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Specialization/near/218028609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Specialization.html#218028609">(Nov 26 2020 at 18:24)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/23072#issuecomment-85960388">https://github.com/rust-lang/rust/issues/23072#issuecomment-85960388</a></p>



<a name="218033117"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Specialization/near/218033117" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremiah Senkpiel <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Specialization.html#218033117">(Nov 26 2020 at 19:32)</a>:</h4>
<p>Ah, hmm, that seems like a different feature than I though. Perhaps there isn't any named/rfc'd feature for this, but I'm thinking specifically about "negative trait bounds for generics" (even if only for <code>Self</code>) to get around conflicting with blanket impls (e.g. <code>From&lt;T&gt; for T</code>).</p>



<a name="218034012"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Specialization/near/218034012" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Specialization.html#218034012">(Nov 26 2020 at 19:49)</a>:</h4>
<p>I expect this will need to be a new feature proposal</p>



<a name="218034292"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Specialization/near/218034292" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Specialization.html#218034292">(Nov 26 2020 at 19:54)</a>:</h4>
<p>tho negative trait bounds on generics isn't in my registers</p>



<a name="218035204"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Specialization/near/218035204" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremiah Senkpiel <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Specialization.html#218035204">(Nov 26 2020 at 20:11)</a>:</h4>
<p><span class="user-mention" data-user-id="211722">@Yoshua Wuyts</span> We've talked about this, do you have any recollection of previous conversations about this "negative trait bounds" thing?</p>



<a name="218036144"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Specialization/near/218036144" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pachi <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Specialization.html#218036144">(Nov 26 2020 at 20:28)</a>:</h4>
<p><span class="user-mention" data-user-id="319552">@Jeremiah Senkpiel</span> maybe you could try in <a class="stream" data-stream-id="144729" href="/#narrow/stream/144729-wg-traits">#wg-traits</a> as they're implementing the next generation torchwood and trait solving infrastructure (called chalk) and face those problems. Of course, <a class="stream" data-stream-id="213817" href="/#narrow/stream/213817-t-lang">#t-lang</a> is also related to it.</p>



<a name="218045107"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Specialization/near/218045107" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Specialization.html#218045107">(Nov 26 2020 at 23:29)</a>:</h4>
<p><span class="user-mention" data-user-id="319552">@Jeremiah Senkpiel</span> enabling negative trait bounds to count towards coherence is one of the requirements to enable async fn main.</p>
<p>We want to implement <code>impl&lt;F, T&gt; Termination for F where F: Future&lt;Output = T&gt;, T: Termination</code>. Which requires we declare that <code>()</code> will never implement <code>Future</code>.</p>



<a name="218045340"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Specialization/near/218045340" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Specialization.html#218045340">(Nov 26 2020 at 23:35)</a>:</h4>
<p>The reason for that is that Termination is defined in libstd, while both Future and unit are defined in libcore.</p>
<p>Termination is implemented for unit. So in order for the generic impl to be valid we need to declare that unit will <em>never</em> implement Future, making it so the generic impl will never accidentally conflict in the future.</p>



<a name="218045400"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Specialization/near/218045400" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Specialization.html#218045400">(Nov 26 2020 at 23:36)</a>:</h4>
<p>I don't know how relevant it is to what's being discussed here; but I think this is what you may be remembering from convos we've had in the past.</p>



<a name="218321976"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Specialization/near/218321976" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Specialization.html#218321976">(Nov 30 2020 at 17:59)</a>:</h4>
<p><span class="user-mention silent" data-user-id="211722">Yoshua Wuyts</span> <a href="#narrow/stream/257204-project-error-handling/topic/Specialization/near/218045340">said</a>:</p>
<blockquote>
<p>The reason for that is that Termination is defined in libstd, while both Future and unit are defined in libcore.</p>
<p>Termination is implemented for unit. So in order for the generic impl to be valid we need to declare that unit will <em>never</em> implement Future, making it so the generic impl will never accidentally conflict in the future.</p>
</blockquote>
<p>this seems like it might be solved by merging core and std</p>



<a name="218321993"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Specialization/near/218321993" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Specialization.html#218321993">(Nov 30 2020 at 17:59)</a>:</h4>
<p>if its an orphan rule issue</p>



<a name="218322016"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Specialization/near/218322016" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Specialization.html#218322016">(Nov 30 2020 at 17:59)</a>:</h4>
<p>that said</p>



<a name="218322087"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Specialization/near/218322087" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Specialization.html#218322087">(Nov 30 2020 at 18:00)</a>:</h4>
<p>the issue with impling Error for Box&lt;dyn Error&gt; and anyhow::Error will probably require a significant amount of work</p>



<a name="218322128"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Specialization/near/218322128" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Specialization.html#218322128">(Nov 30 2020 at 18:00)</a>:</h4>
<p>my understanding is that it requires that chalk implements the lattice rule</p>



<a name="218322149"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Specialization/near/218322149" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Specialization.html#218322149">(Nov 30 2020 at 18:00)</a>:</h4>
<p>which isn't planned afaik</p>



<a name="218322185"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Specialization/near/218322185" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Specialization.html#218322185">(Nov 30 2020 at 18:00)</a>:</h4>
<p>we should probably double check with <span class="user-group-mention" data-user-group-id="692">@WG-traits</span></p>



<a name="218322287"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Specialization/near/218322287" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Specialization.html#218322287">(Nov 30 2020 at 18:01)</a>:</h4>
<p>what is the lattice rule again? sounds familiar <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="218322304"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Specialization/near/218322304" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Specialization.html#218322304">(Nov 30 2020 at 18:01)</a>:</h4>
<p>let me grab a link rq</p>



<a name="218322366"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Specialization/near/218322366" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Specialization.html#218322366">(Nov 30 2020 at 18:02)</a>:</h4>
<p><a href="https://github.com/rust-lang/rfcs/blob/master/text/1210-impl-specialization.md#the-lattice-rule">https://github.com/rust-lang/rfcs/blob/master/text/1210-impl-specialization.md#the-lattice-rule</a></p>



<a name="218334311"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Specialization/near/218334311" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Specialization.html#218334311">(Nov 30 2020 at 19:33)</a>:</h4>
<p>nice, I have references to semi-lattices and consistency types</p>



<a name="218343925"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Specialization/near/218343925" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Specialization.html#218343925">(Nov 30 2020 at 20:49)</a>:</h4>
<p><span class="user-mention silent" data-user-id="220273">Jane Lusby</span> <a href="#narrow/stream/257204-project-error-handling/topic/Specialization/near/218321976">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="211722">Yoshua Wuyts</span> <a href="#narrow/stream/257204-project-error-handling/topic/Specialization/near/218045340">said</a>:</p>
<blockquote>
<p>The reason for that is that Termination is defined in libstd, while both Future and unit are defined in libcore.</p>
<p>Termination is implemented for unit. So in order for the generic impl to be valid we need to declare that unit will <em>never</em> implement Future, making it so the generic impl will never accidentally conflict in the future.</p>
</blockquote>
<p>this seems like it might be solved by merging core and std</p>
</blockquote>
<p>FWIW Pattern gets around this for <code>char</code> and <code>FnOnce</code> with 'compiler magic': <a href="https://doc.rust-lang.org/nightly/src/core/ops/function.rs.html#145">https://doc.rust-lang.org/nightly/src/core/ops/function.rs.html#145</a></p>



<a name="218344076"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Specialization/near/218344076" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Specialization.html#218344076">(Nov 30 2020 at 20:50)</a>:</h4>
<p><span aria-label="grimacing" class="emoji emoji-1f62c" role="img" title="grimacing">:grimacing:</span></p>



<a name="218344958"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Specialization/near/218344958" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Specialization.html#218344958">(Nov 30 2020 at 20:58)</a>:</h4>
<p>Another option might be to make coherence take into account <a href="https://doc.rust-lang.org/nightly/unstable-book/language-features/negative-impls.html">https://doc.rust-lang.org/nightly/unstable-book/language-features/negative-impls.html</a></p>
<p>And to add an <code>impl !Future for () {}</code></p>
<p>(That seems like it'd be a bit more elegant of a way to handle the pattern problem, too.  Would at least be an interesting separate feature flag to have available to play with in core/std and see if we'd want to make it available more generally.)</p>



<a name="218345209"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Specialization/near/218345209" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Specialization.html#218345209">(Nov 30 2020 at 20:59)</a>:</h4>
<p>my understanding was that negative impls somehow play poorly with exhaustiveness and how solvable the trait system is</p>



<a name="218345418"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Specialization/near/218345418" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Specialization.html#218345418">(Nov 30 2020 at 21:01)</a>:</h4>
<p>Sounds like a niko question, since I really don't understand how all that stuff works.</p>



<a name="218409441"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Specialization/near/218409441" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Specialization.html#218409441">(Dec 01 2020 at 11:33)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span> oh my</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>